import getLogger from './server/src/utils/logger.js'
import express from 'express'
import path from 'path'
import app from './server/src/server.js'

const LOG = getLogger('backend')
const PORT = process.env.PORT || 3000

LOG.verbose('Configuring frontend...')
app.use('/', express.static('web/dist'))
LOG.trace('Frontend configured on / for ./web/dist and ./web/src')

LOG.verbose('Starting server...')
app.listen(PORT, () => {
  LOG.trace(`Backend server running on http://localhost:${PORT}/api`)
  LOG.info(`Server started on url http://localhost:${PORT}/`)
  LOG.trace(`Health check at http://localhost:${PORT}/api/ping`)
})
